import Moveable from './moveable.js';
import config from './gameconfig.js';
import Bullet from './bullet.js';
class Tank extends Moveable {
    constructor(x, y, imgSrc, width, height, life) {
        super(x, y, imgSrc, width, height, life);
        this.attack = config.TankBaseAttack;
        this.shootReady = true;
        this.shootInterval = 500;
        this.imageList = config.PlayerSprites;
    }
    chageImage() {
        this.img.src = this.imageList[this.direction];
    }
    controlMove(col) {
        this.chageImage();
        return this.move(col);
    }
    shoot() {
        if (this.shootReady) {
            this.shootReady = false;
            setTimeout(() => {
                this.shootReady = true;
            }, this.shootInterval);
            let x = this.x + this.width / 2 - config.BulletSize / 2;
            let y = this.y + this.height / 2 - config.BulletSize / 2;
            let bullet = new Bullet(x, y);
            return bullet;
        }
        else {
            return false;
        }
    }
}
export default Tank;
